﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace TestApprovalSystem.NetStruct
{
    #region AikInfoRegion

    internal struct DataIP
    {
        byte length;
        internal byte Length
        {
            get { return length; }
            set { length = value; }
        }

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
        char[] data;
        internal char[] Data
        {
            get { return data; }
            set { data = value; }
        }
    }

    internal struct DataName
    {
        byte length;
        internal byte Length
        {
            get { return length; }
            set { length = value; }
        }

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
        char[] data;
        internal char[] Data
        {
            get { return data; }
            set { data = value; }
        }
    }

    internal struct DataMac
    {
        byte length;
        internal byte Length
        {
            get { return length; }
            set { length = value; }
        }

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
        char[] data;
        internal char[] Data
        {
            get { return data; }
            set { data = value; }
        }
    }

    internal struct DataInf
    {
        byte length;
        internal byte Length
        {
            get { return length; }
            set { length = value; }
        }

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 30)]
        char[] data;
        internal char[] Data
        {
            get { return data; }
            set { data = value; }
        }
    }

    internal struct AikInfo
    {
        private DataIP ip;

        public DataIP IP
        {
            get { return ip; }
            set { ip = value; }
        }
        private DataName name;

        public DataName Name
        {
            get { return name; }
            set { name = value; }
        }
        private DataMac mac;

        public DataMac Mac
        {
            get { return mac; }
            set { mac = value; }
        }
        private DataInf inf;

        public DataInf Inf
        {
            get { return inf; }
            set { inf = value; }
        }
    }

    #endregion



    #region ModuleInfoRegion

    internal struct DataVer
    {
        byte schematicVersion;
        internal byte SchematicVersion
        {
            get { return schematicVersion; }
            set { schematicVersion = value; }
        }

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
        byte[] programVersion;
        internal byte[] ProgramVersion
        {
            get { return programVersion; }
            set { programVersion = value; }
        }
    }

    internal struct DataCDate
    {
        byte length;
        internal byte Length
        {
            get { return length; }
            set { length = value; }
        }

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
        char[] data;
        internal char[] Data
        {
            get { return data; }
            set { data = value; }
        }
    }

    internal struct DataCTime
    {
        byte length;
        internal byte Length
        {
            get { return length; }
            set { length = value; }
        }

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
        char[] data;
        internal char[] Data
        {
            get { return data; }
            set { data = value; }
        }
    }

    internal struct NetData
    {
        public byte adr;
        public byte fun;
        public byte sz;
        public byte vkl;
        public DataVer ver;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
        public char[] text;
        public DataCDate CDate;
        public DataCTime CTime;
    }

    #endregion

}
